<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:include="public/page_css::page_css ('修改库位')" />

<body>
<div class="layui-fluid larry-wrapper">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="">
                    <input type="hidden" name="id">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">库位名称</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" lay-verify="required" name="mc" id="mc" placeholder="请输入库位名称" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库区名称</label>
                            <div class="layui-input-inline">
                                <select lay-ignore="lay-ignore" class="js-data-example-ajax" lay-verify="required" name="selectId" id="sskqid" select2 style="width: 193px"></select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">可承受重量</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="cszl" id="cszl"  placeholder="请输入可承受重量" />
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">可容纳体积</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="rntj" id="rntj" placeholder="可容纳体积" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库位托盘数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="tps"  placeholder="请输入库位托盘数"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库位层数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="cs" placeholder="请输入库位层数"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">拣货顺序</label>
                            <div class="layui-input-inline">
                                <input type="text" name="xlsx" placeholder="请输入拣货顺序"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库位属性</label>
                            <div class="layui-input-inline">
                                <select name="sx">
                                    <option value="0">正常</option>
                                    <option value="1">封存</option>
                                    <option value="2">管控</option>
                                    <option value="3">禁入</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库位类型</label>
                            <div class="layui-input-inline">
                                <select name="lx">
                                    <option value="0">存储库位</option>
                                    <option value="1">件拣货库位</option>
                                    <option value="2">箱拣货库位</option>
                                    <option value="3">箱/件拣货库位</option>
                                    <option value="4">暂存库位</option>
                                    <option value="5">集货库位</option>
                                    <option value="6">组装工作库位</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-inline">
                                <input type="text" name="bz" placeholder="备注"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">是否可以混放货品</label>
                            <div class="layui-input-inline">
                                <select name="hphf" id="hphf" lay-filter="test">
                                    <option value="0">不允许</option>
                                    <option value="1">允许</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库位高度</label>
                            <div class="layui-input-inline">
                                <input type="text" name="kwgd" placeholder="请输入库位高度"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">库位可用系数（0-1）</label>
                            <div class="layui-input-inline">
                                <input type="text" name="kyxs" id="kyxs" lay-verify="required|number" placeholder="请输入库位可用系数"  autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-inline" id="div1" style="margin-left: 320px;">
                                <label class="layui-form-label">同货品批次是否可以混放</label>
                                <div class="layui-input-inline">
                                    <select name="pchf">
                                        <option value="0">不允许</option>
                                        <option value="1">允许</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--<div class="layui-form-item" style="margin-left: 320px;top:-180px; ">-->
                            <!--<div class="layui-inline" id="div1">-->
                                <!--<label class="layui-form-label">同货品批次是否可以混放</label>-->
                                <!--<div class="layui-input-inline">-->
                                    <!--<select name="pchf">-->
                                        <!--<option value="0">不允许</option>-->
                                        <!--<option value="1">允许</option>-->
                                    <!--</select>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" jq-filter="submit" lay-submit="" lay-filter="editkuwei">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                    <input type="hidden" th:value="${id}" id="kid">
                </form>
            </section>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>

<script th:inline="javascript">
    $(function () {

    })
</script>
<script>

    layui.use(['myform','zzpUtils','form','jquery'],function () {
        var form = layui.form,
            zzpUtils = layui.zzpUtils,
            $ = layui.jquery;
        zzpUtils.select2({
            elem:"#sskqid",  //dom
            url:"/wmslibraryposition/addSearchArea",
            data: function (params) {
                var query = {
                    mc: params.term
                };
                return JSON.stringify(query);
            }
        });
        var ids=$("#kid").val();
        zzpUtils.action({
            url:"/kuwei/getFind",
            data: JSON.stringify({id:ids}),
            success:function (data) {
                zzpUtils.loadJsonDataToForm(data);
                var sfhf=$("#hphf").val();
                if(sfhf==0){
                    var mychar = document.getElementById("div1").style.display ="block";
                }else if(sfhf==1){
                    var mychar = document.getElementById("div1").style.display ="none";
                }
            },error: function (xhr, textStatus) {
                console.log(textStatus);
                console.log(xhr)
            }
        });
        form.on("submit(editkuwei)",function(data){
            if($("#kyxs").val()>1||$("#kyxs").val()<0){
                layer.msg("库位可用系数需在0-1之间");
            }else {
                zzpUtils.confirm("是否确定修改", function (index) {
                    zzpUtils.action({
                        url: "/wmslibraryposition/edit",
                        data: JSON.stringify(data.field),
                        success: function (data) {
                            setTimeout(function () {
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                                top.layer.msg(data.title);
                            }, 500);
                        }, error: function (xhr, textStatus) {
                            console.log(textStatus);
                            console.log(xhr)
                        }
                    })
                })
            }
            return false;

        });
        form.on('select(test)', function(data){
            if(data.value==1){
                var mychar = document.getElementById("div1").style.display ="none";
            }else if(data.value==0){
                var mychar = document.getElementById("div1").style.display ="block";
            }
        });
    });
</script>
</html>